package org.railage.server.dao;

import java.util.List;

import org.railage.server.entities.Route;

/**
 * DAO for route entity.
 * 
 * @author Cyril Fertikov
 * 
 */
public interface RouteDAO {

	/**
	 * Adds new route with given parameters.
	 * 
	 * @param routeName
	 *            Name of route.
	 * @param stations
	 *            Station names separated by commas.
	 * @param timesAfterPrev
	 *            Times after previous stations separated by commas.
	 * @param timesOnStations
	 *            Times spent on each station separated by commas.
	 * @return Result value:<br>
	 *         0 - added successfully,<br>
	 *         1 - route already exists,<br>
	 *         -1 - DB session error.
	 */
	int addRoute(String routeName, String stations, String timesAfterPrev,
			String timesOnStations);

	/**
	 * Deletes route with given name.
	 * 
	 * @param routeName
	 *            New route's name.
	 * @return Result value:<br>
	 *         0 - deleted successfully,<br>
	 *         1 - trips on route exist,<br>
	 *         -1 - DB session error.
	 */
	int deleteRoute(String routeName);

	/**
	 * Gets list of all existing routes.
	 * 
	 * @return List of routes.
	 */
	List<Route> getAllRoutes();

	/**
	 * Gets route the trip passes.
	 * 
	 * @param tripID
	 *            Trip ID.
	 * @return Route object.
	 */
	Route getRouteByTripID(int tripID);
}
